import React from 'react'
import './charts.less'
import * as echarts from 'echarts'

class Charts extends React.Component {
  componentDidMount() {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(this.props.dom))
    // 绘制图表
    myChart.setOption(this.props.options)
  }

  render() {
    return <div className="box" id={this.props.dom}></div>
  }
}

export default Charts
